package threaddemo;

public class demo1 {
    private static boolean isquit = false;
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (!isquit) {
                System.out.println("工作中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("完成");
        });
        thread.start();
        Thread.sleep(1000);
        isquit = true;
        System.out.println("isquit = true");
    }
}
